ActiveExec 1.5

Copyright ⌐ 1998 Activity All rights reserved. (http://www.activitysoft.com/)
Released: 11/01/98
License: LICENSE.DOC
For more information on this and other products visit Activity's Product Page.

Description

ActiveExec allows you to execute programs/files from ASP, Windows Scripting Host, Visual Basic, or any other Active Scripting Host. You can choose to wait for the process, get the return code, and capture the output of DOS/Win32 Console programs.

New Features

Version 1.5 Beta Version 1.0

Installation

Copy ActiveExec.DLL to the <WINDIR>\SYSTEM32 directory and run:
      regsvr32.exe <WINDIR>\SYSTEM32\ActiveExec.DLL

Technical Support

Technical Support is available to all registered owners of ActiveExec. This is available with 24 hour response via email at info@activitysoft.com.

ActiveExec.Process

Set proc = Server.CreateObject(ActiveExec.Process)

Properties

Boolean NoWait [Read/Write]
This flag tells ActiveExec to wait for (or not wait for) the process to complete. When you choose not to wait for the process to complete, the contents of ReturnCode and OutputStream are not available. The process just runs in the background and exits whenever it is supposed to. Programs that expect keyboard input may hang and never finish executing.
proc.NoWait = True or
proc.NoWait = False (default)

String OutputStream [Read Only]
This is the output of a DOS/Console application. It is exactly as written to the console by the application, so if you need to write it to an HTML page you will probably need to enclose the output in PRE tags. This is not available if NoWait=true.

Response.Write proc.OutputStream
String InputStream [Write Only] new
This is the Input Stream to send to a DOS/Console application. This is usually to be used with DOS/Console applications that understand STDIN/STDOUT.
proc.InputStream = "input" & vbcrlf & "more input" & vbcrlf
String Expires [Read Only] new
Provides information about the registration status of ActiveExec. This will tell you how many days you have left to register or how many days past due your registration is. (program functionality is disabled when past due)
proc.InputStream = "input" & vbcrlf & "more input" & vbcrlf

long ReturnCode [Read Only]
The Return Code of the last executed application. This is not available if NoWait=true.

Response.Write proc.ReturnCode

Methods

Execute(Command Line)
The Execute Method has a single argument, Command Line. Please remember that you should always provide the full path (C:\Path\program.exe) to the program you wish to execute. For executing DOS programs, you may need to use the command processor.
proc.Execute 'C:\WINNT\System32\CMD.EXE /C "C:\path\to\dos\program.exe"'
Any Win32 console application or other Windows application can be executed directly, as demonstrated below.
proc.Execute "C:\WINNT\System32\PING.EXE www.activitysoft.com"
If the program cannot execute, an error is returned. Below is a list of basic error codes. One thing to note, under ASP, you will need to make sure that the IUSR_SERVERNAME user has access to execute the application. This can be configured from the Security Tab under File Properties, or with CACLS from the command line.

LoadInputStream(Filename) new
Loads the contents of a file into the InputStream (buffer to be sent to the executing application). This is usually to be used with DOS/Console applications that understand STDIN/STDOUT.

proc.LoadInputStream 'C:\TEMP\InputFile.TXT'
List Of Basic Error Codes
NO_ERROR                    0
ERROR_INVALID_FUNCTION      1
ERROR_FILE_NOT_FOUND        2
ERROR_PATH_NOT_FOUND        3
ERROR_TOO_MANY_OPEN_FILES   4
ERROR_ACCESS_DENIED         5
ERROR_INVALID_HANDLE        6
ERROR_ARENA_TRASHED         7
ERROR_NOT_ENOUGH_MEMORY     8
ERROR_INVALID_BLOCK         9
ERROR_BAD_ENVIRONMENT       10
ERROR_BAD_FORMAT            11
ERROR_INVALID_ACCESS        12
ERROR_INVALID_DATA          13

Example

<%@ LANGUAGE="VBSCRIPT" %>

<%
Set proc = Server.CreateObject("ActiveExec.Process")

CommandLine = "C:\WINNT\System32\PING.EXE www.activitysoft.com"

proc.Execute CommandLine

Response.Write "Program " & CommandLine & " executed with return code " & _
                proc.ReturnCode & "<BR>"
Response.Write "Output is:"
Response.Write "<BLOCKQUOTE><PRE>"
Response.Write proc.OutputStream
Response.Write "</PRE></BLOCKQUOTE>"
%>